#include "DIALOG.h"

/*********************************************************************
*
*       Defines
*
**********************************************************************
*/
#define ID_WINDOW_0    (GUI_ID_USER + 0x00)


/*********************************************************************
*
*       _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  { WINDOW_CreateIndirect, "StandbyWindow", ID_WINDOW_0, 0, 0, 1024, 600, 0, 0x0, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
};

extern GUI_CONST_STORAGE GUI_BITMAP bmIsStandbylogo;

extern GUI_CONST_STORAGE GUI_BITMAP bmstandbylogo;
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) 
{
	WM_HWIN hItem; 
	GUI_RECT Rect; 

  switch (pMsg->MsgId) 
  {
  case WM_INIT_DIALOG:
  
    hItem = pMsg->hWin;
    WINDOW_SetBkColor(hItem, GUI_MAKE_COLOR(0x001B1B1B));

	break;

   case WM_PAINT:   
	 WM_GetClientRect(&Rect);   
//	 GUI_EnableAlpha(1);
	 GUI_SetAlpha(85);   // Set alpha value for drawing operations
     GUI_SetBkColor(GUI_MAKE_COLOR(0x001B1B1B)); 
     GUI_Clear();              // ...with alpha blending
     GUI_SetAlpha(0);          // Set alpha value to default

	 GUI_DrawBitmap(&bmstandbylogo, (Rect.x1-Rect.x0-144)/2, (Rect.y1-Rect.y0-86)/2);    
	              
	  break;
   case WM_TOUCH:
	  GUI_EndDialog(pMsg->hWin, 0); 
	   break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       CreateStandbyWindow
*/
WM_HWIN CreateStandbyWindow1024x600(WM_HWIN parent);
WM_HWIN CreateStandbyWindow1024x600(WM_HWIN parent) {
  WM_HWIN hWin;
  WM_HWIN hClient;

  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, parent, 0, 0);
  WM_SetHasTrans(hWin);  
  hClient = WM_GetClientWindow(hWin);         // Get handle of client window
  WM_SetHasTrans(hClient);                         // Set transparency
  return hWin;
}
